﻿using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace MostPopularInterface
{
    class Garage:IEnumerable
    {
        Car [] car=new Car[4];
        public Garage()
        {
            car[0] = new Car { MaxSpeed = 250, Name = "BMW" };
            car[1] = new Car { MaxSpeed = 150, Name = "NIssan" };
            car[2] = new Car { MaxSpeed = 350, Name = "Lada" };
            car[3] = new Car { MaxSpeed = 50, Name = "Moped" };

        }

        //public IEnumerator GetEnumerator()
        //{
        //    return car.GetEnumerator();
        //}

        //IEnumerator IEnumerable.GetEnumerator()
        //{
        //    return car.GetEnumerator();
        //}
        public IEnumerator GetEnumerator()
        {
            yield return car[0];
            yield return car[3];
            yield return car[1];
            yield return car[2];
            yield return car[2];
            yield return car[2];
            yield return car[2];
            //foreach (var c in car)
            //{
            //    yield return c;
            //}
            
        }

    }
}
